import { Suspense, ReactNode } from "react";
import RouterBeforeEach from "./RouterBeforeEach";

/**
 * @description 路由懒加载
 * @param {Element} Comp 需要访问的组件
 * @returns element
 */
const lazyLoad = (Comp: any): ReactNode => {
	return (
		<Suspense
		// fallback={
		// 	<Spin
		// 		size="large"
		// 		style={{
		// 			display: "flex",
		// 			alignItems: "center",
		// 			justifyContent: "center",
		// 			height: "100%"
		// 		}}
		// 	/>
		// }
		>
			<RouterBeforeEach>
				<Comp />
			</RouterBeforeEach>
		</Suspense>
	);
};

export default lazyLoad;
